﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Artemis;

namespace JAWWS
{
    class FloorNode : SceneGraphNode
    {
        public Floor floor;

        public FloorNode(MainForm main)
        {
            this.child = null;
            this.sibling = null;
            this.floor = new Floor(main);
            this.LocalTransMatrix = this.IdMatrix;
        }
        public override void draw()
        {
            GL.glEnable(GLenum.GL_TEXTURE_2D);
            GL.glBindTexture(GLenum.GL_TEXTURE_2D, floor.texID);
            floor.draw();
            GL.glDisable(GLenum.GL_TEXTURE_2D);
        }
        public void updateNode(float transX, float transY, float transZ,
                                   float scalarX, float scalarY, float scalarZ,
                                   float rotAng, float xaxis, float yaxis, float zaxis)
        {
            GL.glMatrixMode(GLenum.GL_MODELVIEW);
            GL.glPushMatrix();
                GL.glLoadIdentity();
                GL.glTranslatef(transX, transY, transZ);
                GL.glRotatef(rotAng, xaxis, yaxis, zaxis);
                GL.glScalef(scalarX, scalarY, scalarZ);
                GL.glGetFloatv(GLenum.GL_MODELVIEW_MATRIX, this.LocalTransMatrix);
            GL.glPopMatrix();
        }
        public void updateFloor()
        {
            GL.glPushMatrix();
               GL.glLoadIdentity();
               GL.glTranslatef(0.0f, 0.0f, 0.0f);
               GL.glScalef(4.0f, 4.0f, 4.0f);             
               GL.glGetFloatv(GLenum.GL_MODELVIEW_MATRIX, this.LocalTransMatrix);
            GL.glPopMatrix();
        }
    }
}
